<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/index.css}" rel="stylesheet"/>
    <link th:href="@{/css/tool.css}" rel="stylesheet"/>
    <!-- 图标  -->
    <link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_1531710_xb357ub1wmg.css"/>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <script th:src="@{/js/marked.min.js}" type="text/javascript"></script>
</head>
<body>
<div th:insert="~{navigation::nav}"></div>
<input type="hidden" id="zbId" th:value="${zbId}">
<div class="layui-fluid main">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-lg9">
            <h1>待评标列表</h1>
            <hr>
            <div class="layui-btn-group demoTable">
                <button class="layui-btn" id="uploadData" data-type="getCheckData">上传评标信息</button>
            </div>
            <table id="scoring" lay-filter="test"></table>
        </div>

        <div class="layui-col-lg3">
            <h1>小提醒</h1>
            <hr>
            <h3>1.评标专家可以在此页面同时打开标书预览和评分页面进行操作</h3>
            <h3>2.评分时按照评分细则的要求进行评分</h3>
            <h3>3.评分时注意各部分的分值，如果出现超出值，将会被视为废弃评标</h3>

        </div>
    </div>
</div>

</body>
<script id="pinbiao" type="text/html">
    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="details">查看标书</a>
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="scoreDetail">评分细则</a>
    <a class="layui-btn layui-btn-xs" lay-event="score">评分</a>
</script>
<script>
    var scoreClass;
    var rowData
    layui.config({base: '/js/'}).extend({
        tableMerge: 'tableMerge'
    });

    layui.use(['table', 'jquery', 'layer', 'util', 'tableMerge','element'], function () {
        var table = layui.table,
            $ = layui.jquery,
            layer = layui.layer,
            util = layui.util,
            element = layui.element;

        var tableId = table.render({
            elem: '#scoring',
            url: '/score/tbInfoSelect',
            height: 312,
            page: true,
            skin: 'col', //行边框风格
            cols: [
                [{type: 'numbers', title: '序号', width: 100, fixed: 'left',align: 'center'},
                    {field: 'd.tbInfo.projectId', title: '投标编号',align: 'center', templet: "<div>{{d.tbInfo.projectId}}</div>"},
                    {field: 'd.zbInfo.title', title: '招标项目名称',align: 'center', templet: "<div>{{d.zbInfo.title}}</div>"},
                    {fixed: 'right', title: '操作', width: 210,align: 'center', toolbar: '#pinbiao'},
                    {field: 'pf', title: '评分',align: 'center',width:80,style:"color:#009688"}
                ]
            ],
            where: {
                zbId: $('#zbId').val()
            },
            done: function (res) {


            }
        });


        table.on('tool(test)', function (obj) {
             rowData = obj.data;
             var data = obj.data
            scoreClass = obj.tr.selector
            if (obj.event === 'details') {
                $.ajax({
                    type: "GET",
                    url: "/shPreview/" + data.tbInfo.fileId,
                    success: function (res) {
                        layer.open({
                            type: 2
                            , shade: 0
                            , title: '标书评分'
                            , content: 'http://luckyli.xyz:8012/onlinePreview?url=' + res.url
                            , area: ['750px', '550px']
                            , maxmin: true
                            , resize: true
                        });
                    }
                });
            } else if (obj.event === 'score') {
                layer.open({
                    type: 2,
                    shade: 0,
                    title: '评分',
                    content: '/score/scoreDetail',
                    area: ['750px', '550px'],
                    skin: 'layui-layer-molv',
                    maxmin: true

                });
            } else if (obj.event === 'scoreDetail') {
                $.ajax({
                    type: "GET",
                    url: "/shPreview/" + data.zbInfo.scoreDetailFileId,
                    success: function (res) {
                        layer.open({
                            type: 2
                            , shade: 0
                            , title: '评分细则'
                            , content: 'http://luckyli.xyz:8012/onlinePreview?url=' + res.url
                            , area: ['750px', '550px']
                            , maxmin: true
                            , resize: true
                        });
                    }
                });
            }
        });
        $("#uploadData").click(function () {
            layer.alert("已上传",function () {
                location.href="/index"
            })
        })
    })
</script>
</html>